/*
 *  lattice.h
 *  EPPI-0.0
 *
 *  Created by Juan Carlos Garcia Orden on 02/02/09.
 *
 */
 
#ifndef _lattice_h_
#define _lattice_h_

#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <sstream>
#include "mecsystem.h"
#include "body.h"
#include "point.h"
#include "COMPONENTS/particle.h"
#include "COMPONENTS/truss.h"

class MecSystem;
class Process;

using namespace std;

class Lattice : public Body
{
public:
	char meshFileName[30];
	int nNodes;
	int nElements;
//	vector<string> vPointNames;	// Names without /systemName
	// edit: starts here ...
	vector< vector<string> > connectSurface; // Connectivity matrix of the surface elements
	// ... and ends here
//	vector< vector<string> > connect;	/** Connectivity matrix */
	vector<double> vCoord;	/** Vector of coordinates of one point */
	int vertexTag;	// Element tag (2=triangle, 4=tetrahedron)
	int nVertex;	// Number of vertexes (3=triangle, 4=tetrahedron)
	string matName;			/** Material */
	double area;			/** area of the section */
/*	Data members from the base class Body
	string name;
	int dim;
	MecSystem* parentSystem;
	vector<Component*> vComponents;
	vector<Component*> vLoads;
	vector<string> vPointNamesSurface;
	vector<Point*> vPPointSurface;
	vector<vector<double> > vLocalPoints;	// Local points, for joints and contact
*/

public:
	Lattice(){}
	Lattice(ifstream &, string, MecSystem*);
	~Lattice(){}
	
	/** Virtual functions from base */
	void setPTPointsComp();		/** Set pointers to points in each component */
	void setPTPointsLoad();		/** Set pointers to points in each load */
	void setPPointSurface();
	void setMatAtComp();
	void getBoundary(vector<vector<string> >&);
	void writeMSH(ofstream&);
	void writeVTU(ofstream&, bool&, bool&, bool&);		
	void writeOOGL(ofstream&);
	void writeFileTemp(const double&, ofstream &);
	void setIniPosBody(vector<double>&);
	
	/** Local functions */
	void readGmsh(ifstream &, vector<vector<string> >&);
	
	
	
};

#endif
